#!/bin/csh -f
# call as: do_it 'runpcsplit-resN $x' $x
# first make a subdirectory pc with: do_it 'mkdir pc'

#cd pcr
cd pc


#gunzip *.gz

if ( -e splitres.tmp ) \rm splitres.tmp
foreach x (`\ls *.outtail`)
    tailout $x >> splitres.tmp
end
foreach x (`\ls *.sum`)
    sumout $x >> splitres.tmp
end

runpcsplit-res.nawk splitres.tmp >> ../$1.dbin
set num1 = $status
set file = ~/Validation/dbres4/.dbres-jurgen-models
set num2 = `gawk -v var=$1 '{if ( match($1,var) ) print $2 }' $file `
if ( $num1 != $num2 ) echo "ERROR" $1 $num1 $num2
\rm splitres.tmp
